package com.xuecheng.filesystem.controller;

import com.xuecheng.filesystem.service.FileUploadService;
import com.xuecheng.framework.domain.filesystem.response.UploadFileResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.util.Map;

/**
 * @Description: 文件上传
 * @Param:
 * @return:
 * @Author: Mr.Yuan
 * @Date:
 */
@RestController
@RequestMapping("/filesystem")
public class FileUploadController implements com.xuecheng.api.file.FileUploadControllerApi {
    /**
     * @Description: 单文件上传
     * @Param: multipart
     * @return: UploadFileResult
     * @Author: Mr.Yuan
     * @Date:
     */
    @Autowired
    private FileUploadService fileUploadService;

    @PostMapping("/upload")
    @Override
    public UploadFileResult fileUpload(@RequestParam("file") MultipartFile file, String userId, String businesskey, String filetag, String metadata) {
        return fileUploadService.fileUpload(file, userId, businesskey, filetag, metadata);
    }
}
